{{if ($this -> erreur_cle):}}
	<div class="sep"></div>
	<div class="msg msg-erreur">
		<p>
			{{=trad('Vous n\'avez pas les droits suffisants pour afficher cette page.', APPLNG)}}
		</p>
	</div>
{{exit;}}
{{endif;}}
{{if (!$this -> habilitation):}}
	<div class="sep"></div>
	<div class="msg msg-erreur">
		<p>
			{{=trad('Vous n\'avez pas les habilitations suffisantes pour afficher cette page.', APPLNG)}}
		</p>
	</div>
{{else:}}
	{{if($this -> erreur_table || !count($this -> datamaj)):}}
	<div class="sep"></div>
	<div class="msg msg-erreur">
		<p>
			{{=trad('La table ' . $this -> table . ' n\'est pas correctement configurée.', APPLNG)}}
		</p>
	</div>
	{{exit;}}
	{{endif;}}
	<img src="{{=URL_SITE}}?titrettf=1&txt={{=trad($this -> titre, APPLNG)}}" alt="{{=trad($this -> titre, APPLNG)}}" title="{{=trad($this -> titre, APPLNG)}}" /><p />
	{{if($this -> message_erreur):}}
	<div class="sep"></div>
	<div class="msg msg-erreur">
		<p>
			{{=trad($this -> message_erreur, APPLNG)}}
		</p>
	</div>
	{{endif;}}
	{{if($this -> message_ok):}}
	<div class="sep"></div>
	<div class="msg msg-ok">
		<p>
			{{=trad("La mise à jour s'est déroulée correctement.", APPLNG)}}
			<br />
			<a href="{{=rw('liste', 'table=' . $this -> table)}}">{{=trad("Retour", APPLNG)}}</a>
		</p>
	</div>
	{{exit;}}
	{{endif;}}
	<div class="sep"></div>
	<form id="add_form" method="post" action="{{=URL_SITE}}" enctype="multipart/form-data">
		{{=form_hidden('MAX_FILE_SIZE', '100000000000')}}
		{{=form_hidden('action_form', 1)}}
		{{=form_hidden('page', $this -> page)}}
		{{=form_hidden('table', $this -> table)}}
		{{=form_hidden('cle', $this -> cle)}}
		{{=form_hidden('id', $this -> id)}}
		<input type="hidden" name="fichierupload" id="fichierupload" value="" />
		<table class="form_crud">
		{{foreach ($this -> champs as $champ):}}
		<tr>
			<td valign="top" style="vertical-align: top; text-align: right;" class="crud_title" width="35%">
				{{=trad($champ['Affichage'], APPLNG)}}{{if($champ["obligatoire"]):}} <sup style="color: red;">*</sup>{{endif;}}
			</td>
			<td valign="top" width="65%">
				{{if ($champ['type'] == 'input'):}}
					{{=form_input($champ['id'], $this -> datamaj[$champ['id']], 50, $champ['max'])}}
				{{elseif ($champ['type'] == 'password'):}}
					{{=form_password($champ['id'], (count($_POST)) ? $this -> datamaj[$champ['id']] : '', 50, $champ['max'])}}
				{{elseif ($champ['type'] == 'date'):}}
					{{=form_date($champ['id'], $this -> datamaj[$champ['id']])}}
				{{elseif ($champ['type'] == 'textarea'):}}
					{{=form_textarea($champ['id'], $this -> datamaj[$champ['id']], $champ['max'])}}
				{{elseif ($champ['type'] == 'hidden'):}}
					{{=form_hidden($champ['id'], $this -> datamaj[$champ['id']])}}
				{{elseif ($champ['type'] == 'select'):}}
					{{=form_select($champ['id'], ($this -> datamaj[$champ['id']]) ? $this -> datamaj[$champ['id']] : $champ['defaut'], $champ['typeselect'], $champ['data'], $champ['premierchoix'], $champ['js'])}}
				{{elseif ($champ['type'] == 'html'):}}
					{{=form_html($champ['id'], $this -> datamaj[$champ['id']], $champ['max'])}}
				{{elseif ($champ['type'] == 'file'):}}
					{{=form_file($champ['id'], $this -> datamaj[$champ['id']], $champ['format'])}}
				{{elseif ($champ['type'] == 'image'):}}
					{{=form_image($champ['id'], $this -> datamaj[$champ['id']], $champ['format'])}}
				{{elseif ($champ['type'] == 'image_resize'):}}
					{{=form_image_resize($champ['id'], $this -> datamaj[$champ['id']], $champ['width'], $champ['height'], $champ['format'])}}
				{{endif;}}
			</td>
		</tr>
		{{endforeach;}}
		<tr>
			<td valign="top" >
				&nbsp;
			</td>
			<td valign="top" >
				{{=btform(trad('MODIFIER', APPLNG))}}
				&nbsp;&nbsp;&nbsp;&nbsp;
				<img onclick="$('#add_form')[0].reset();" class="submit" src="{{=URL_SITE}}?imgform=1&txt={{=trad('ANNULER', APPLNG)}}&fc=0,0,0&bc=255,255,255&tp=12" alt="{{=trad('ANNULER', APPLNG)}}" title="{{=trad('ANNULER', APPLNG)}}" onmouseout="this.src = '{{=URL_SITE}}?imgform=1&txt={{=trad('ANNULER', APPLNG)}}&fc=0,0,0&bc=255,255,255&tp=12'" onmouseover="this.src = '{{=URL_SITE}}?imgform=1&txt={{=trad('ANNULER', APPLNG)}}&fc=255,255,255&bc=0,0,0&tp=12'" />
			</td>
		</tr>
		</table>
	</form>
	<p />
	<i><sup style="color: red;">*</sup>&nbsp;{{=trad('Champs obligatoires', APPLNG)}}</i>
	<div class="sep"></div>
	<img style="position: relative; top: 5px;" src="{{=URL_SITE}}img/back.png" alt="{{=trad('Retour', APPLNG)}}" title="{{=trad('Retour', APPLNG)}}" />&nbsp;&nbsp;<a href="{{=rw('liste', 'table=' . $this -> table)}}">{{=trad('Retour', APPLNG)}}</a>
{{endif;}}